Repository navigation
fix(validation): make dangerous-pattern refusal terminal and name the working bypass (#7) - #8
Merged
Merged
Conversation
… working bypass The defense-in-depth dangerous-pattern validator returned a generic refusal that did not signal the block is terminal, so agents retry-looped reworded variants on a non-retryable refusal (issue #7). - security-validator: the refusal now states it is a terminal result ("do not retry"), names the working server-side bypass (CODE_EXECUTOR_SKIP_DANGEROUS_PATTERNS env / security.skipDangerousPatternCheck config), and clarifies that the per-call skipDangerousPatternCheck request parameter is intentionally ignored (issue aberemia24#56). The message stays generic and never reveals which pattern matched. - index: correct the misleading skipDangerousPatternCheck tool-description and schema text in both the executeTypescript and executePython registrations so it no longer implies a working per-call bypass. - tests: add "Terminal refusal message guidance" cases and fix the dead import in pattern-bypass.test.ts (src/security.js -> src/validation/security-validator.js) that had silently disabled the whole file (51 regression tests now run again). Scope: issue #7 direction #1 only (refusal message + discoverability). False-positive reduction (context-aware matching) is intentionally out of scope. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements direction #1 of #7: the defense-in-depth dangerous-pattern validator
returned a generic refusal that did not signal the block is terminal, so agents
retry-looped reworded variants on a non-retryable refusal.
The refusal message now:
do not retry), which alone stops the retry-loops;CODE_EXECUTOR_SKIP_DANGEROUS_PATTERNS=trueenv var /security.skipDangerousPatternCheckconfig (operator decision);skipDangerousPatternCheckrequest parameter is intentionally ignored for security (HIGH: skipDangerousPatternCheck flag bypasses ALL pattern validation aberemia24/code-executor-MCP#56), so callers are not misled into retrying with it;Changes
src/validation/security-validator.ts— enriched refusal message (keeps thedangerous patternsubstring for back-compat; one message per matched pattern is preserved, so the multi-pattern error contract still holds).src/index.ts— corrected the misleadingskipDangerousPatternChecktool-description and zod schema text in both theexecuteTypescriptandexecutePythonregistrations; it no longer implies a working per-call bypass.tests/security/pattern-bypass.test.ts— added aTerminal refusal message guidance (Issue #7)block, and fixed a dead import (../../src/security.js→../../src/validation/security-validator.js) that had silently disabled the whole file. 51 security regression tests run again.Testing (TDD)
tests/security/pattern-bypass.test.ts: 51/51 green.tsc --noEmit: clean.npm run build:binary); closed-stdin smoke test exits0.No test pins the old message text, and the full-suite delta vs. baseline is the 51 resurrected tests plus pre-existing, network/runtime-flaky and broken-import files (unrelated to this change).
Scope / out of scope
Follow-ups (separate)
tests/security.test.ts,tests/handlers/tool-execution-handler.test.ts(likely more). Worth a dedicated cleanup PR.Addresses #7 — direction #1 (and #3). Deliberately does not auto-close: direction #2
(false-positive reduction) remains open as a follow-up; close #7 manually if #2 is dropped.
🤖 Generated with Claude Code